{include file="Public:header2"/}
<body style="min-height: 100%;background-color: #fff">
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form onsubmit="return false;">
                        <div class="layui-form" wid100 lay-filter="">
                            <div class="layui-form-item">
                                <label class="layui-form-label">账户余额</label>
                                <div class="layui-input-block">
                                    <input type="text" value="{$money}" autocomplete="off"  placeholder="请输入账号" class="layui-input" style="width: 300px" disabled>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">类型</label>
                                <div class="layui-input-inline" style="width: 300px">
                                    <input type="radio" name="type_is" value="1" lay-verify="required"  class="layui-input" title="充值" checked>
                                    <input type="radio" name="type_is" value="2" lay-verify="required"  class="layui-input" title="扣除" >
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">修改数量</label>
                                <div class="layui-input-block">
                                    <input type="text" name="money" value="" autocomplete="off"  placeholder="请输入修改数量" class="layui-input" style="width: 300px">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <input type="hidden" name="id" value="{$id}">
                                    <input type="hidden" name="type" value="{$type}">
                                    <button class="layui-btn" onclick="return check()">确认保存</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="Public:footer"/}
</body>
</html>
<script type="text/javascript">
    layui.use(['layer','form'], function(){

    });

    function check(){
        var url="{:url('/admin/chongzhi')}";
        var $ = layui.$;
        var load=layer.load(2);
        $.post(url,$("form").serialize(),function(data){
            if(data.status==1){
                layer.msg(data.msg,{icon:1,time:1500},function(){
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index);
                    parent.location.reload();
                });
            }else{
                layer.msg(data.msg,{icon:2,anim:6,time:1500},function(){
                    layer.close(load);
                });
            }
        })
    }
</script>
